#include <stdio.h>
#include <stdlib.h>
#include "def.h"
#include "nrio.h"
#include "nrarith.h"
#include "nralloc.h"

int main(int argc, char *argv[])
{
	long nrh,nrl,nch,ncl;
	byte **I;
	char filename[100];
	int nb_pix_blanc=0, nb_pix_tot=0, i, j;

	I=LoadPGM_bmatrix(argv[1],&nrl,&nrh,&ncl,&nch); //rice_binar.pgm
	printf("Image chargée. \n");
	
	printf("%d, %d\n", nb_pix_blanc, nb_pix_tot);
	sprintf(filename, "%s.txt",argv[1]);
	printf("avec argv %s\n", filename);
	
	FILE *f=fopen(filename, "a");
	fprintf(f, "%d\n", (nch-ncl));
	fclose(f);
	
	free_bmatrix(I,nrl,nrh,ncl,nch);
	printf("I libérée. \n");
	
	return 1;
}
